<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->bigIncrements('user_id');
            $table->char('phone',11)->comment('phone')->unique();
            $table->char('password',32)->comment('密码');
            $table->char('username',30)->comment('用户名');
            $table->char('face',255)->comment('头像')->nullable();
            $table->json('album')->comment('相册')->nullable();
            $table->longText('introduction')->comment('简介')->nullable();
            $table->char('lat',40)->comment('纬度')->nullable();
            $table->char('lon',40)->comment('经度')->nullable();
            $table->bigInteger('area_id')->comment('区域id')->nullable();
            $table->softDeletes();
            $table->timestamps();
            $table->index(['phone']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
